package com.bit.demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 74646
 * Date: 2022-02-08
 * Time: 12:35
 */
class Animal{
    public String name;
    public int age;

    public Animal(String name,int age){
        this.name = name;
        this.age =age;
    }
    public void eat(){
        System.out.println(this.name + "正在吃");
    }
}

class Dog extends Animal{
    public Dog(String name,int age){
        super(name,age); //调用父类带有两个参数的构造方法
    }
}

class Bird extends Animal{

    public String wing;
    public String name;

    public Bird(String name,int age){
        super(name,age); //调用父类带有两个参数的构造方法
    }
    public void fly(){
        System.out.println(this.name+"正在飞");
    }
}

public class TestDemo {
    public static void main(String[] args) {
        Bird bird = new Bird( "大白",5);
        System.out.println(bird.name);
        bird.fly();
    }

    public static void main1(String[] args) {

        Dog dog = new Dog("小黑",15);
        Bird bird = new Bird( "大白",5);

        dog.eat();
        bird.eat();
        bird.fly();
    }
}
